package com.bigdata.movieticketapi.controller;

import com.bigdata.movieticketapi.common.pojo.PageResult;
import com.bigdata.movieticketapi.entity.MovieType;
import com.bigdata.movieticketapi.service.IMovieTypeService;
import com.bigdata.movieticketapi.vo.req.MovieTypeReqVO;
import com.bigdata.movieticketapi.vo.req.PageMovieTypeReqVO;
import com.bigdata.movieticketapi.vo.resp.PageMovieTypeRespVO;
import com.bigdata.movieticketapi.vo.resp.SelectListRespVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author movie
 * @since 2023-11-07
 */
@RestController
@RequestMapping("/api")
@Api(tags = "电影类型模块")
public class MovieTypeController {

    @Resource
    private IMovieTypeService iMovieTypeService;

    @PostMapping("/admin/movieType/add")
    @ApiOperation(value = "添加影片类型")
    public void addMovieType(@RequestBody @Valid MovieTypeReqVO vo){
        iMovieTypeService.addMovieType(vo);
    }

    @PostMapping("/admin/movieType/edit")
    @ApiOperation(value = "编辑影片类型")
    public void updateMovieType(@RequestBody @Valid MovieType movieType){
        iMovieTypeService.updateMovieType(movieType);
    }

    @PostMapping("/admin/movieType")
    @ApiOperation(value = "获取影片类型分页列表")
    public PageResult<PageMovieTypeRespVO> pageMovieTypes(@RequestBody @Valid PageMovieTypeReqVO vo){
        return iMovieTypeService.pageMovieTypes(vo);
    }

    @PostMapping("/admin/movieType/selectList")
    @ApiOperation(value = "电影类型选择器列表")
    public List<SelectListRespVO> getMovieTypeSelectList(){
        return iMovieTypeService.getMovieTypeSelectList();
    }
}
